package net.takela.common.web.model;


import java.util.List;

/**
 *
 * @author baboy
 * create at 20/12/2016
 */
public class ListResult<T> extends Model {
    private static final long serialVersionUID = 9163773941618629079L;
    private int pageSize;
    private int pageNum;
    private long totalCount;
    private List<T> items;
    /**
     * 
     */
    public ListResult() {
    }
    /**
     * 
     */
    public ListResult(long totalCount) {
        this.totalCount = totalCount;
    }
    /**
     * 
     */
    public ListResult(long totalCount,int pageSize,int pageNum) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
    }
    /**
     * 
     */
    public ListResult(long totalCount, int pageSize, int pageNum, List<T> items) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.items = items;
    }
    /**
     * 
     */
    public ListResult(List<T> items) {
        this.items = items;
        this.totalCount = items.size();
    }
    /**
     * 
     */
    public static <T> ListResult<T> of(long totalCount, int pageNum, int pageSize, List<T> items) {
        return new ListResult<>(totalCount, pageSize, pageNum, items);
    }
    /**
     * 
     */
    public int getPageNum() {
        return pageNum;
    }
    /**
     * 
     */
    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }
    /**
     * 
     */
    public int getPageSize() {
        return pageSize;
    }
    /**
     * 
     */
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    /**
     * 
     */
    public long getTotalCount() {
        return totalCount;
    }
    /**
     * 
     */
    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }
    /**
     * 
     */
    public List<T>  getItems() {
        return items;
    }
    /**
     * 
     */
    public void setItems(List<T>  items) {
        this.items = items;
    }

}
